package msc.dodo.wtb.util;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;

/**
 * 转byte数组工具类
 */
public class ConvertByteUtil {

    public static byte[] getFileToBytes(String url){
        File file = new File(url);
        FileInputStream fileInputStream = null;
        byte[] bar = null;
        try{
            bar = new byte[(int)file.length()];

            fileInputStream = new FileInputStream(file);
            fileInputStream.read(bar);
        }catch(IOException e){
            e.printStackTrace();
        }finally {
            if(fileInputStream!=null){
                try {
                    fileInputStream.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
        return bar;
    }
}
